import { createApp } from 'vue'
import ImageViewer from '@/components/ImageViewer.vue'

export default {
  install(app) {
    // 创建 ImageViewer 实例
    const imageViewerInstance = createApp(ImageViewer)
    const imageViewerEl = document.createElement('div')
    document.body.appendChild(imageViewerEl)
    const imageViewer = imageViewerInstance.mount(imageViewerEl)

    // 添加全局方法
    app.config.globalProperties.$showImage = (url,width = '30%') => {
      imageViewer.open(url,width)
    }
  }
}
